import request from "@/utils/request"
import type {
  SpuListParams,
  SpuListResponse,
  TrademarkList,
  BaseSaleAttrList,
} from "./model/spuModel"
enum Api {
  delSpu = "/admin/product/deleteSpu", // /{spuId} delete
  saveSpuInfo = "/admin/product/saveSpuInfo", // post data
  getSpuList = "/admin/product", // get /{page}/{limit} query
  getAllTrademarkList = "/admin/product/baseTrademark/getTrademarkList",
  getBaseSaleAttrList = "/admin/product/baseSaleAttrList",
}

// spu基础数据列表
export const getSpuListApi = ({ page, limit, category3Id }: SpuListParams) => {
  return request.get<any, SpuListResponse>(
    `${Api.getSpuList}/${page}/${limit}`,
    {
      params: {
        category3Id,
      },
    }
  )
}

// 添加spu
// export const saveSpuInfoApi = (data)=>{
//   return request.post<any,null>(`${Api.saveSpuInfo}`,{data})
// }

// 获取所有品列表
export const getAllTrademarkListApi = () => {
  return request.get<any, TrademarkList>(Api.getAllTrademarkList)
}

// 获取销售属性数据
export const getBaseSaleAttrListApi = () => {
  return request.get<any, BaseSaleAttrList>(Api.getBaseSaleAttrList)
}
